package Frame.readerFrame;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.Toolkit;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import Frame.common.BackgroundFrame;
import Frame.librarianFrame.BookManageFrame;
import controller.Controller;

public class ReaderBackgroundFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	private JPanel panel1;
	private JPanel contentPane;
	private Controller controller;
	private JLabel label9;
	public ReaderBackgroundFrame(Controller controller) {
	//controller = new Controller();    //注意 这里实例化了controller类
	this.controller = controller;
	controller.setReaderBackgroundFrame(this);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕大小
	this.setTitle("图书管理系统");
	this.setBounds(0,0,screenSize.width, screenSize.height);
	this.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);//这个就是设置窗口最大化
	//this.setResizable(false);// 禁用最大化按钮
	this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	URL reader = getClass().getResource("/logo/用户背景.jpg"); 
	contentPane = new BackgroundFrame(reader);
	contentPane.setBackground(Color.WHITE);
	contentPane.setBounds(0, 0, 1920, 1080);
	contentPane.setLayout(null); 
	contentPane.add(panel1()); 
	contentPane.setOpaque(false);
	setContentPane(contentPane);	
	this.setVisible(true); 
} 
public JPanel panel1() {
	panel1 = new JPanel(); 
	panel1.setForeground(Color.WHITE);
	panel1.setLocation(0, 0);
	panel1.setSize(1920, 86);
	panel1.setLayout(null); 

	JLabel label1 = new JLabel("个人信息");
	label1.setIcon(new ImageIcon(BookManageFrame.class.getResource("/logo/个人信息.png")));
	label1.setBackground(SystemColor.activeCaption);
	label1.addMouseListener(controller);
	label1.setName("personalImformation");
	panel1.add(label1);
	label1.setFont(new Font("华文楷体", Font.BOLD, 20));
	label1.setBounds(15, 10, 160, 66);

	JLabel label2 = new JLabel("图书查询");
	label2.setIcon(new ImageIcon(ReaderBackgroundFrame.class.getResource("/logo/图书查询.png")));
	label2.setFont(new Font("华文楷体", Font.BOLD, 20));
	label2.setBackground(SystemColor.activeCaption);
	label2.addMouseListener(controller);
	label2.setName("bookFind");
	label2.setBounds(200, 10, 160, 66);
	panel1.add(label2);

	JLabel label3 = new JLabel("借阅查询 & 续借");
	label3.setIcon(new ImageIcon(BookManageFrame.class.getResource("/logo/借阅查询.png")));
	label3.setFont(new Font("华文楷体", Font.BOLD, 20));
	label3.setBackground(SystemColor.activeCaption);
	label3.setBounds(385, 10, 233, 66);
	label3.addMouseListener(controller);
	label3.setName("borrowQueryByUser");
	panel1.add(label3); 
	
	JLabel label7 = new JLabel("欢迎您！");
	label7.setForeground(new Color(244, 164, 96));
	label7.setFont(new Font("华文行楷", Font.BOLD, 25));
	label7.setBounds(1474, 32, 104, 25);
	panel1.add(label7);
	
	JLabel label8 = new JLabel("读者：");
	label8.setForeground(new Color(244, 164, 96));
	label8.setFont(new Font("华文行楷", Font.BOLD, 25));
	label8.setBounds(1577, 32, 78, 25);
	panel1.add(label8);
	
	label9 = new JLabel("202025710604");
	label9.setForeground(new Color(244, 164, 96));
	label9.setFont(new Font("华文行楷", Font.BOLD, 26));
	label9.setBounds(1656, 31, 186, 25);
	panel1.add(label9);
	
	JLabel label10 = new JLabel("欢迎您！");
	label10.setText(new SimpleDateFormat("yyyy 年 MM 月 dd 日  EEEE").format(new Date()));	//设置每日更新的日期label
	label10.setForeground(new Color(0, 0, 0));
	label10.setFont(new Font("华文楷体", Font.BOLD, 21));
	label10.setBounds(1049, 31, 288, 25);
	panel1.add(label10);
	panel1.setOpaque(false);
//	contentPane.add(panel1);
	return panel1;
}
public Controller getController() {
	return controller;
}
public void setController(Controller controller) {
	this.controller = controller;
}
public JLabel getLabel9() {
	return label9;
}
public void setLabel9(JLabel label9) {
	this.label9 = label9;
}

}
